<template>
	<view>
		<uni-easyinput v-model="item.name" placeholder="请输入姓名"></uni-easyinput>
		<uni-easyinput v-model="item.phone" placeholder="请输入电话"></uni-easyinput>
		<button type="primary" @click="add">提交</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				item:{
					name: "",
					phone:""
				}
			}
		},
		methods: {
			add() {
				const db = uniCloud.database();
				db.collection('contacts').add(this.item).then(res => {
					console.log(res)
					uni.navigateBack({
						data:1
					})
				})
			}
		}
	}
</script>

<style>

</style>
